package com.qdu.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import com.qdu.service.CollectionService;
import com.qdu.service.CotenancyService;

@Controller
public class CollectionController {
	@Autowired
	private CollectionService collect;
	@Autowired
	private CotenancyService cotenancy;
	   @GetMapping("/collection/{Uid}")
	    public String publishhouse_page(@PathVariable String Uid,Model model) {
	    	model.addAttribute("Uid",Uid);
	    	model.addAttribute("collect",collect.getOneCollectionByUid(Uid));
	    	return "mycollection";
	    	
	    }
	   
	   
	   
	   @GetMapping("/findbyHtopic")
	    public String findbyHad(String Htopickey,Model model) {
	    	model.addAttribute("findbyHtopic",cotenancy.getCorrectHpic(Htopickey));
	    	return "cotenancyTOPIC";
	    }
	    

	    
	    @GetMapping("/findbyHprice")
	    public String findbyHprice(String high,String low,Model model) {
	    	Integer h=Integer.parseInt(high);
	    	Integer l=Integer.parseInt(low);
	    	model.addAttribute("cotenancylistbyHprice",cotenancy.getCorrectCprice(h, l));
	    	return "cotenancyPRICE";
	    }
}
